<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    //随机猜数字
    function cai(min,max){
        return Math.floor(Math.random()*(max-min-1)+min);
    }
    let boom=cai(1,10); 
    let num; 
    while(true){
        num=prompt("输入你猜的数字:"); 
        if(num===boom){
            alert('你踩雷了'); 
            break;
        }else if(num>boom){
            alert('你猜大了');
        }else{
        alert('你猜小了');
        }
    }

</script>
</html>